//
//  XMGHeaderRefreshView.m
//  BuDeJie19
//
//  Created by hjj on 2016/12/3.
//  Copyright © 2016年 hjjuny. All rights reserved.
//
#import "XMGHeaderRefreshView.h"

@interface XMGHeaderRefreshView ()
@property (weak, nonatomic) IBOutlet UILabel *labelView;
@property (weak, nonatomic) IBOutlet UIImageView *arrowView;
@property (weak, nonatomic) IBOutlet UIView *loadView;

@end

@implementation XMGHeaderRefreshView
- (void)setIsRefreshing:(BOOL)isRefreshing
{
    _isRefreshing = isRefreshing;
    
    _loadView.hidden = !isRefreshing;
    
    _arrowView.hidden = isRefreshing;
    _labelView.hidden = isRefreshing;
}
- (void)setIsNeedLoad:(BOOL)isNeedLoad
{
    _isNeedLoad = isNeedLoad;
    
    _labelView.text = isNeedLoad?@"松开立即刷新":@"下拉可以刷新";
    [UIView animateWithDuration:0.25 animations:^{
        
        _arrowView.transform = isNeedLoad?CGAffineTransformMakeRotation(-M_PI + 0.00001):CGAffineTransformIdentity;
    }];
}

- (void)awakeFromNib
{
    [super awakeFromNib];
    self.autoresizingMask = UIViewAutoresizingNone;
}
+ (instancetype)headerView
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
